#include "MyGraphic.h"
#include "CImg.h"
#include <string>
using namespace std;
using namespace cimg_library;

class MyCImg : public MyGraphic
{
private:	
	string _name;
	CImg<int> _canvas;
	CImgDisplay _display;
public:	
	//Constructor
	MyCImg() {

	}
	MyCImg(int size_x, int size_y, int size_z, int size_c, string name) {
		_name = name;
		_canvas.assign(size_x, size_y, size_z, size_c);
		_canvas.fill(0);
		
	}
	//Drawing methods
	void DrawLine(char stroke[], float strokeWidth, int x1, int y1, int x2, int y2) {				
		_canvas.draw_line(x1, y1, x2, y2, stroke, strokeWidth);
		_display.assign(_canvas, _name.data(), 0);
		
		while(!_display.is_closed())
			_display.wait();
	}
	void DrawRectangle(char stroke[], float strokeWidth, int x, int y, int width, int height) {		
		_canvas.draw_rectangle(x, y, x+width, y+height, stroke, strokeWidth);
		_display.assign(_canvas, _name.data(), 0);
		
		while(!_display.is_closed())
			_display.wait();
	}
	void DrawEllipse(char stroke[], float strokeWidth, int x, int y, int width, int height) {
		_canvas.draw_ellipse(x+width/2, y+height/2, width/2, height/2, 1.0F, stroke, strokeWidth);
		_display.assign(_canvas, _name.data(), 0);

		while(!_display.is_closed())
			_display.wait();
	}
	void FillRectangle(char color[], int x, int y, int width, int height) {
		//To be implemented		
	}
	void FillEllipse(char color[], int x, int y, int width, int height) {
		//To be implemented
	}
};